{extend name="public/base"}

{block name="style"}
<link rel="stylesheet" href="__STATIC__/admin/css/news.css" media="all" />
<link rel="stylesheet" type="text/css" href="__STATIC__/uploadify/uploadify.css">
<style>
    .brand_logo img{
        width: 200px;
        height:200px;
        border-radius: 100%;
    }
</style>
{/block}


{block name="main"}
<body class="childrenBody">
<form class="layui-form" action="?" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">奖品名称</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="name" lay-verify="required" placeholder="请输入大转盘名称" value="{$data.name|default=''}">
        </div>
    </div>
    <div class="layui-form-item brand_logo">
        <label class="layui-form-label">奖品图片</label>
        <div class="site-demo-upload">
            <img id="LAY_demo_upload" src="__STATIC__/home/images/jx_beta.png">
            <input type="file" name="image" class="layui-upload-file">
        </div>
    </div>
    <div class="layui-form-item brand_logo">
        <label class="layui-form-label">中奖几率</label>
        <div class="layui-input-block">
            <input type="number" max="100" class="layui-input" name="probability" lay-verify="required" placeholder="中奖几率，最大100" value="{$data.probability|default=''}">
        </div>
    </div>
    <div class="layui-form-item brand_logo">
        <label class="layui-form-label">奖品数量</label>
        <div class="layui-input-block">
            <input type="number" max="100" class="layui-input" name="num" lay-verify="required" placeholder="奖品数量" value="{$data.num|default=''}">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">是否启用</label>
            <div class="layui-input-block">
                <input type="checkbox" name="status" class="tuijian" {eq name="data.status|default='1'" value="1"}checked{/eq} title="启用" value="1">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <input type="hidden" name="img" value="{$data.img|default=''}">
            <input type="hidden" name="id" value="{$data.id|default=''}">
            <input type="hidden" name="xydzp_id" value="{$xydzp_id}">
            <button class="layui-btn" lay-submit="" lay-filter="send_form">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
{/block}

{block name="javascript"}
<script>
    layui.use(['form', 'upload', 'jquery'], function(){  //如果只加载一个模块，可以不填数组。如：layui.use('form')

        var upload = layui.upload, $ = layui.jquery; //获取upload模块

        //实例化一个上传控件
        upload({
            url: '{:url("base/upload_image", ["image_type" => 4])}'
            ,success: function(data){
                if (data.code == 200) {
                    $("#LAY_demo_upload").attr('src', data.data[0].host_path);
                    $("input[name='img']").val(data.data[0].thumb_path);
                }
            }
        })
    });
</script>
{/block}